package cn.smbms.service.user;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

import cn.smbms.pojo.User;

public interface UserService {

	/**
	 * 登录方法
	 * @param userCode
	 * @param userPassword
	 * @return
	 * @throws Exception
	 */
	public User login(String userCode,String userPassword)throws Exception;
	
	/**
	 * 通过userCode获取User
	 * @param userCode
	 * @return
	 * @throws Exception
	 */
	public User getLoginUser(@Param("userCode")String userCode) throws Exception;
	
	/**
	 * 增加用户信息
	 * @param connection
	 * @param user
	 * @return
	 * @throws Exception
	 */
	public int add(User user)throws Exception;

	
	/**
	 * 通过条件分页查询-userList
	 * @param connection
	 * @param userName
	 * @param userRole
	 * @return
	 * @throws Exception
	 */
	public List<User> getUserListByPages(Map<String,Object> map)throws Exception;	
	
	/**
	 * 通过条件查询-用户表记录数
	 * @param connection
	 * @param userName
	 * @param userRole
	 * @return
	 * @throws Exception
	 */
	public int getUserCount(String userName)throws Exception;
	
	/**
	 * 通过userId删除user
	 * @param delId
	 * @return
	 * @throws Exception
	 */
	public int deleteUserById(Integer id)throws Exception; 
		
		
		/**
		 * 通过userId获取user
		 * @param connection
		 * @param id
		 * @return
		 * @throws Exception
		 */
		public User getUserById(Integer id)throws Exception; 
		
		/**
		 * 修改用户信息
		 * @param connection
		 * @param user
		 * @return
		 * @throws Exception
		 */
		public int modify(User user)throws Exception;
		
		/**
		 * 查询用户名和密码
		 */
		public User getUserPwd(@Param("userCode")String userCode,@Param("userPassword")String userPassword);
		
		/**
		 * 修改当前用户密码
		 * @param connection
		 * @param id
		 * @param pwd
		 * @return
		 * @throws Exception
		 */
		public int updatePwd(Integer id,String pwd)throws Exception;
		
		/**
		 * 查询用户编号
		 */
		public User selectUserCode(@Param("userCode")String userCode);
}
